<%--
	author:
	time:2011-5-11 14:32:49
--%>
<%@page language="java" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib uri="TowkerTagLib" prefix="rbac"%>
<%@include file="/commons/include/html_doctype.html"%>
<html>
<head>
	<title>修改</title>
	<%@include file="/commons/include/upd.jsp" %>
    <script type="text/javascript" src="${ctx}/js/calendar/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript">
$(function(){
	jQuery("#dataForm").validate(
	{
		rules: {
			password : {
				required: true
			}
		},
		messages: {
		},
		submitHandler:function(form)
		{
			jQuery(form).ajaxSubmit(_options);
		}
	});
	if(${user.userStatus} != 3)
	$("#pid").hide();
});
validCallBack = function()
{
	//添加页面自定义校验
	return true;
};
//刷新树节点
_callback=function()
{
	//parent.refresh();
	var name = $("#name").val();
	//parent.refresh_upd(name);
}
function changeUserGroups(el) {
	if(el.value == 3) {
		$("#pid").show();
	} else {
		$("#pid").hide();
	}
}
	</script>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" class="listLogo">
	<tr>
		<td class="title">用户信息修改</td>
		<td>
			<div class="menuTool">
				<a class="save" id="dataFormSave" href="#">保存</a>
				<a class="back" href="${ctx}/manage/sys/user/getDiffUser.htm?pid=${user.pid}">返回</a>
			</div>
		</td>
	</tr>
</table>
<div class="line"></div>
<form id="dataForm" method="post" action="updUser2.htm">
	<table border="0" cellspacing="1" cellpadding="0" class="listTable">
	<c:if test="${user.pid!=0}">
		<tr>
		  <td class="form_title">数据权限：</td>
		  <td class="form_input"><input type="radio" name="dataAuthType" id="radio" value="A"<c:if test="${user.dataAuthType == 'A'}"> checked</c:if> />
		    所有公司数据
		      <input type="radio" name="dataAuthType" id="radio2" value="S"<c:if test="${user.dataAuthType == 'S'}"> checked</c:if> />
用户本公司数据</td>
	  </tr>
		<tr>
			<td class="form_title">帐号：</td>
			<td class="form_input"><input size="40" type="text" id="account" name="account" value="${user.account}" /></td>
		</tr>
		<tr>
			<td class="form_title">密码：</td>
			<td class="form_input"><input size="40" type="password" id="password" name="password" value="${user.password}" /></td>
		</tr>
	</c:if>
		<tr>
			<td class="form_title">姓名：</td>
			<td class="form_input">
				<input size="40" type="text" id="name" name="name" value="${user.name}" />
			</td>
		</tr>
        <tr>
          <td class="form_title">用户代码：</td>
          <td class="form_input"><input size="40" type="text" id="userCode" name="userCode" value="${user.userCode}" /></td>
        </tr>
        <tr>
		  <td class="form_title">客户代码：</td>
		  <td class="form_input"><input name="customCode" type="text" id="customCode" value="${user.customCode}"></td>
	  </tr>
		<tr>
		  <td class="form_title">出生日期：</td>
		  <td class="form_input"><input name="dateOfBirth" type="text" id="dateOfBirth" value="<fmt:formatDate pattern="yyyy-MM-dd" value="${user.dateOfBirth}" />" readonly="readonly" class="Wdate" onFocus="WdatePicker({isShowWeek:true})"></td>
	  </tr>
		<tr>
		  <td class="form_title">性别：</td>
		  <td class="form_input"><input type="radio" name="gender" id="gender1" value="1"<c:if test="${user.gender == 1}"> checked</c:if>>
	      男
	        <input type="radio" name="gender" id="gender2" value="2"<c:if test="${user.gender == 2}"> checked</c:if>>
	      女</td>
	  </tr>
		<tr>
		  <td class="form_title">用户性质：</td>
		  <td class="form_input"><select name="userNature" id="userNature">
		    <option value="1"<c:if test="${user.userNature == 1}"> selected</c:if>>公司员工</option>
            <option value="2"<c:if test="${user.userNature == 2}"> selected</c:if>>经销商或客户</option>
	      </select></td>
	  </tr>
		<tr>
		  <td class="form_title">公司：</td>
		  <td class="form_input"><select id="coCode" name="coCode">
				<option value="" >请选择</option>
				 <c:forEach items="${companiesList}" var="d" varStatus="status">
					<option value="${d.co_code}"<c:if test="${d.co_code eq user.coCode}"> selected</c:if>>${d.co_code}[${d.co_name }]</option>
				</c:forEach>
		</select>
	      <input name="coName" type="text" id="coName" value="${user.coName}"></td>
	  </tr>
		<tr>
		  <td class="form_title">部门：</td>
		  <td class="form_input"><select name="deptCode" id="deptCode">
		    <option value="" >请选择</option>
		    <c:forEach items="${departList}" var="d" varStatus="status">
		      <option value="${d.dep_code}"<c:if test="${d.dep_code eq user.deptCode}"> selected</c:if>>${d.dep_code}[${d.dep_name }]</option>
	        </c:forEach>
	      </select>
	      <input name="deptName" type="text" id="deptName" value="${user.deptName}"></td>
	  </tr>
		<tr>
		  <td class="form_title">职位：</td>
		  <td class="form_input"><input name="duty" type="text" id="duty" value="${user.duty}"></td>
	  </tr>
		<tr>
		  <td class="form_title">手机号码：</td>
		  <td class="form_input"><input name="mobile" type="text" id="mobile" value="${user.mobile}"></td>
	  </tr>
		<tr>
		  <td class="form_title">办公电话：</td>
		  <td class="form_input"><input name="phone" type="text" id="phone" value="${user.phone}"></td>
	  </tr>
		<tr>
		  <td class="form_title">传真：</td>
		  <td class="form_input"><input name="fax" type="text" id="fax" value="${user.fax}"></td>
	  </tr>
		<tr>
		  <td class="form_title">EMAIL：</td>
		  <td class="form_input"><input name="email" type="text" id="email" value="${user.email}"></td>
	  </tr>
      <tr>
		  <td class="form_title">申请状态：</td>
	    <td class="form_input"><select name="userStatus" id="userStatus" onChange="changeUserGroups(this)">
		    <option value="1"<c:if test="${user.userStatus == 1}"> selected</c:if>>申请中</option>
            <option value="2"<c:if test="${user.userStatus == 2}"> selected</c:if>>拒绝</option>
		    <option value="3"<c:if test="${user.userStatus == 3}"> selected</c:if>>正式用户</option>
	      </select>
		    <select name="pid" id="pid">
		      <option value="0">请选择用户组</option>
              <c:forEach items="${userGroups}" var="d" varStatus="status">
              <c:if test="${d.name ne '未审核用户组'}">
		      <option value="${d.id}"<c:if test="${d.id == user.pid}"> selected</c:if>>${d.name}</option>
              </c:if>
	        </c:forEach>
          </select></td>
	  </tr>
	</table>
<input type="hidden" id="id" name="id" value="${user.id}" />
	<c:if test="${user.pid==0}">
		<input size="40" type="hidden" id="account" name="account" value="${user.account}" />
	</c:if>
  <input type="hidden" id="usertype" name="usertype" value="${user.usertype}" />
</form>
</body>
</html>
